package homework1;

import java.util.Scanner;

public class LoginSystem {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        LoginStrategy loginStrategy = null;
        System.out.println("欢迎使用登录系统！");

        while (true) {
            System.out.println("请选择登录方式：");
            System.out.println("1. 账户密码登录");
            System.out.println("2. 手机号验证码登录");
            System.out.println("3. 邮箱登录");
            System.out.println("4. 扫码登录");
            System.out.println("5. 退出");

            int choice = scanner.nextInt();
            switch (choice) {
                case 1:
                    loginStrategy = new AccountLoginImpl();
                    break;
                case 2:
                    loginStrategy = new PhoneCodeLoginImpl();
                    break;
                case 3:
                    loginStrategy = new EmailLoginImpl();
                    break;
                case 4:
                    loginStrategy = new QRCodeLoginImpl();
                    break;
                case 5:
                    System.out.println("拜拜了您嘞");
                    break;
                default:
                    System.out.println("无效的选择，请重新输入！");
                    continue;
            }

            loginStrategy.login();
        }
    }
}
